extends ../layout

block meta
    link(rel="stylesheet", href="#{options.cdn_path}/js/dataTable/css/jquery.dataTables.css?v=#{options.site_version}")
    link(rel="stylesheet", href="#{options.cdn_path}/js/dataTable/css/jquery.dataTables_themeroller.css?v=#{options.site_version}")
    link(rel="stylesheet", href="#{options.cdn_path}/js/jqueryUi/css/jquery-ui.min.css?v=#{options.site_version}")
    link(rel="stylesheet", href="#{options.cdn_path}/js/artDialog/skins/default.css?v=#{options.site_version}")
    style
        .dataTables_length select { width: 80px;}
        .fg-toolbar { height: 30px;}

block content
    // 传递参数
    tagsClass = true
    include ../common/_admin_navbar
    .content
        .header
            h1.page-title 网站设置
        ul.breadcrumb
            li
                a(href="/admin") 首页
                span.divider /
            li.active 标签管理
        .container-fluid
            .row-fluid
                .well
                    table#otable.table.table-striped.table-bordered(cellpadding="0", cellspacing="0", border="0", width="100%")
                        thead
                            tr
                                th(width="10%") id
                                th(width="60%") 标签名
                                th(width="10%") 文章数量
                                th(width="20%") 操作
                        tbody
                include ../common/_admin_footer

block script
    script(src="#{options.cdn_path}/js/dataTable/js/jquery.dataTables.min.js?v=#{options.site_version}")
    script(src="#{options.cdn_path}/js/artTemplate/js/template.min.js?v=#{options.site_version}")
    script(src="#{options.cdn_path}/js/artDialog/jquery.artDialog.min.js?v=#{options.site_version}")
    script#manageTemp(type="text/html")
        |<a href="/admin/tags/delete/<%=id%>" class="delete_show">
        |<i class="icon-remove"></i>删除
        |</a>
    script
        $(function(){
            $('#otable').dataTable({
                "bLengthChange": true,
                "bFilter": true, //搜索栏
                "bSort": false, //是否支持排序功能
                "bInfo": true, //显示表格信息
                "bStateSave": false, 
                "sPaginationType": "full_numbers", //分页，一共两种样式，full_numbers和two_button(默认)
                "bProcessing": true,
                "bServerSide": true,
                "iDisplayLength": 10,
                "oLanguage": {
                    "sLengthMenu": "每页显示 _MENU_ 记录",
                    "sZeroRecords": "对不起，查询不到任何相关数据",
                    "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",
                    "sInfoEmtpy": "找不到相关数据",
                    "sInfoFiltered": "(数据表中共为 _MAX_ 条记录)",
                    "sProcessing": "正在加载中...",
                    "sSearch": "搜索：",
                    "aaSorting": [[1, "desc"]],  //第一个参数表示表示Browser列。第二个参数为 desc或是asc
                    "oPaginate": {
                        "sFirst":    "首页",
                        "sPrevious": "上一页 ",
                        "sNext":     "下一页 ",
                        "sLast":     "尾页 "
                    }
                }, //多语言配置
                "sAjaxSource": "/admin/tags/list_json",
                "bJQueryUI": true,
                "aoColumnDefs": [
                    {
                        "aTargets": [3],
                        "mData": null,
                        "mRender": function (data, type, full) {
                            return template.render('manageTemp', {id: full[0]});
                        }
                    }
                ],
                "aLengthMenu": [[10, 25, 50], ["10条", "25条", "50条"]]  //设置每页显示记录的下拉菜单
            });
        });